<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

/**
 * 前台路由
 */
Route::group(['namespace'=>'Home'],function(){
    Route::get('/', 'IndexController@index');
});

/**
 * 后台路由
 */
Route::group(['middleware' => ['login'],'namespace' => 'Admin'],function(){
    Route::get('admin','IndexController@index');
    Route::get('/skin-config', 'IndexController@skinConfig');
    //商品路由
    Route::get('admin/goods-list','GoodsController@index');
    Route::get('admin/goods-add','GoodsController@add');
    Route::post('admin/goods-addRes','GoodsController@addRes');
    Route::get('admin/goods-update/{id}','GoodsController@update');
    Route::post('admin/goods-updateRes','GoodsController@updateRes');
    Route::get('admin/goods-delete','GoodsController@delete');
    Route::get('admin/changeGoodsStatus','GoodsController@changeStatus');

    //分类路由
    Route::get('admin/cate-list','CateController@index');
    Route::get('admin/cate-add','CateController@add');
    Route::post('admin/cate-addRes','CateController@addRes');
    Route::get('admin/cate-update/{id}','CateController@update');
    Route::post('admin/cate-updateRes','CateController@updateRes');
    Route::get('admin/cate-delete','CateController@delete');

    //用户路由
    Route::get('admin/user-list','UserController@index');

    //评论路由
    Route::get('admin/comment-list','CommentController@index');
    Route::get('admin/comment-reply','CommentController@reply');
    Route::get('admin/changeCommentStatus','CommentController@changeCommentStatus');

    //轮播图路由
    Route::get('admin/carousel-list','CarouselController@index');
    Route::get('admin/carousel-sort','CarouselController@sort');
    Route::get('admin/carousel-delete','CarouselController@delete');
    Route::get('admin/carousel-add','CarouselController@add');
    Route::post('admin/carousel-addRes','CarouselController@addRes');
    
    //订单路由
    Route::get('admin/orders-list','OrdersController@index');
    Route::get('admin/orders-detail/{id}','OrdersController@detail');


});

Route::group(['namespace' => 'Admin'],function(){

    //后台登录
    Route::get('admin/login','AdminController@login');
    Route::any('admin/loginRes','AdminController@loginRes');


});

/**
 * 小程序路由
 */
Route::group(['namespace' => 'Home'],function(){
    Route::any('/wechat','WechatController@index');
});

/**
 * 小程序接口
 */
Route::group(['namespace' => 'Api'],function(){
    //首页
    Route::get('/api/index','IndexController@index');
    //加载更多
    Route::get('/api/moreGoods','IndexController@moreGoods');
    //首页添加购物车
    Route::any('/api/add-cart-index','IndexController@addCart');

    //商品详情
    Route::get('/api/goods-detail','GoodsController@detail');
    
    //商品分类
    Route::get('/api/cate-list','CateController@index');
    //分类商品
    Route::get('/api/goods-list','CateController@goodsInfo');
    
    //添加购物车
    Route::get('/api/cart-add','CartController@add');
    //购物车商品
    Route::get('/api/cart-list','CartController@index');
    //购物车商品删减
    Route::get('/api/cart-reduce','CartController@reduce');
    //删除购物车商品
    Route::get('/api/cart-delete','CartController@delete');
    //用户路由
    Route::get('/api/user/getSessionKey','UserController@getSessionKey');
    Route::get('/api/user/authLogin','UserController@authLogin');

    //订单接口
    Route::any('/api/orders/index','OrdersController@index');
    //订单数量接口
    Route::any('/api/orders/num','OrdersController@getOrdersNum');
    
    //购物车结算
    Route::any('/api/orders/cart-buy','OrdersController@buyCart');

    //创建购物车订单
    Route::any('/api/pay/cart-pay','PayController@creatCartPay');
    //微信支付
    Route::any('/api/pay/pay_now','PayController@payNow');
    Route::any('/api/pay/test','PayController@test');
    //支付回调
    Route::any('/api/pay/notify','PayController@notify');
    
    //评论订单接口
    Route::any('/api/comment/index','CommentController@index');
    Route::any('/api/comment/add','CommentController@addCommentInfo');




});
